<template >
  <div class="main">
    <div class="divmian">
      <el-row  :gutter="4" class="panel-group">
        <el-col :xs="5" :sm="5" :lg="6" class="card-panel-col" >
          <router-link to="/student/list">
          <div class="card-panel" >
            <div class="card-panel-icon-wrapper icon-people">
              <svg-icon
                icon-class="peoples"
                class-name="card-panel-icon"
              ></svg-icon>
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">学生总数</div>
                <span :class="'rgb3737170'">
                  <count-to
                    :start-val="0"
                    :end-val="studentCount"
                    :duration="6000"
                    class="card-panel-num"
                  />
                </span>
            </div>
          </div>
          </router-link>
        </el-col>
      </el-row>
    </div>
    <div class="divmian">
      <div class="analysis-area fl">
        <div class="z-panel">
          <div class="z-panel-header">
            <h4>
              性别
            </h4>
          </div>
          <div class="z-panel-body">
            <div class="service-cont">
              <div class="service-list must-list active">
                <ve-pie
                  :data="studentSex_chartData"
                  :settings="studentSex_chartSettings"
                  legend-position="bottom"
                  height="280px"
                ></ve-pie>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="analysis-area f2">
        <div class="z-panel">
          <div class="z-panel-header">
            <h4>
              年级
            </h4>
          </div>
          <div class="z-panel-body">
            <div class="service-cont">
              <div class="service-list must-list active">
                <ve-histogram
                  :data="studentGrade_chartData"
                  :settings="studentGrade_chartSettings"
                  legend-position="bottom"
                  height="280px"
                ></ve-histogram>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="divmian">
      <div class="analysis-area f1">
        <div class="z-panel">
          <div class="z-panel-header">
            <h4>
              籍贯
            </h4>
          </div>
          <div class="z-panel-body">
            <div class="service-cont">
              <div class="service-list must-list active">
                <ve-map
                  :data="studentNative_chartData"
                  width="80%"
                  height="800px"
                  :events="chartMapEvents"
                  :settings="studentNative_chartData"
                ></ve-map>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import store from "@/store";
import moment from "moment";
import CountTo from "vue-count-to";
import VeLine from "v-charts/lib/line";
import VePie from "v-charts/lib/pie";
import VeHistogram from "v-charts/lib/histogram";
import VeMap from "v-charts/lib/map";
import {getStudentCount, getAnalysisStudentSex, getAnalysisStudentGrade, getAnalysisStudentNative} from '@/api/student';

export default {
  components: { CountTo, VeLine, VeMap, VePie, VeHistogram},
  data() {
    return {
      studentCount: 0,
      mystore:'',

      studentSex_chartSettings:{ offsetY: 120 },
      studentSex_chartData:{
        columns: ['性别', '数量'],
        rows: [ ]
      },
      studentGrade_chartSettings:{ offsetY: 120 },
      studentGrade_chartData:{
        columns: ['年级', '数量'],
        rows: [ ]
      },
      studentNative_chartSettings:{ offsetY: 120 },
      studentNative_chartData:{
        columns: ['籍贯', '数量'],
        rows: [ ]
      },
    };
  },

  created() {
    this.getStudentCount();
    this.getAnalysisStudentSex();
    this.getAnalysisStudentGrade();
    this.getAnalysisStudentNative();
  },

  methods: {
    getStudentCount() {
      getStudentCount().then(rsp => {
        if (rsp.code === 0) {
          this.studentCount = rsp.data;
        } else {
          this.$message.error(rsp.msg);
        }
      });
    },
    getAnalysisStudentSex() {
      getAnalysisStudentSex().then(rsp => {
        if (rsp.code === 0) {
          this.studentSex_chartData.rows = rsp.data;
        } else {
          this.$message.error(rsp.msg);
        }
      });
    },
    getAnalysisStudentGrade() {
      getAnalysisStudentGrade().then(rsp => {
        if (rsp.code === 0) {
          this.studentGrade_chartData.rows = rsp.data;
        } else {
          this.$message.error(rsp.msg);
        }
      });
    },
    getAnalysisStudentNative() {
      getAnalysisStudentNative().then(rsp => {
        if (rsp.code === 0) {
          this.studentNative_chartData.rows = rsp.data;
        } else {
          this.$message.error(rsp.msg);
        }
      });
    },
  }
};
</script>
<style lang="scss" scoped>
.annexfontSize {
  font-size: 12px;
}

.main {
  margin-left: 5px;
  margin-top: 5px;
  background-color: #f4f4f4;
  font-family: "Hiragino Sans GB";
  padding:20px;
}
.panel-group {
  .card-panel-col {
    margin-bottom: 15px;
  }
  .card-panel {
    height: 108px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.05);
    &:hover {
      .card-panel-icon-wrapper {
        color: #fff;
      }
      .icon-people {
        background: #40c9c6;
      }
      .icon-message {
        background: #36a3f7;
      }
      .icon-money {
        background: #f4516c;
      }
      .icon-shopping {
        background: #34bfa3;
      }
    }
    .icon-people {
      color: #40c9c6;
    }
    .icon-message {
      color: #36a3f7;
    }
    .icon-money {
      color: #f4516c;
    }
    .icon-shopping {
      color: #34bfa3;
    }
    .card-panel-icon-wrapper {
      float: left;
      margin: 14px 0 0 14px;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }
    .card-panel-icon {
      float: left;
      font-size: 48px;
    }
    .card-panel-description {
      float: right;
      font-weight: bold;
      margin: 26px;
      margin-left: 0px;
      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }
      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}
.clearfix {
  overflow: hidden;
}
.header-ct {
  height: 320px;
  .left-ct {
    width: 49%;
    background: #fff;
    margin-right: 1%;
    .divmiddel {
      height: 100px;
    }
  }
  .fl {
    float: left;
  }
  .f2 {
    float: right;
  }
  .middel-ct {
    width: 24%;
    .divmiddel {
      height: 100px;
      background: #fff;
      margin-bottom: 8px;
      padding: 25px 0px 0px 40px;
      overflow: hidden;
      .middeleft {
        float: left;
        padding-right: 20px;
        div {
          height: 50px;
          width: 50px;
          background-color: #f4f4f4;
          padding: 10px 0px 0px 10px;
          border-radius: 25px;
        }
      }
      .middelright {
        float: left;
        cursor: pointer;
      }
    }
  }
  .right-ct {
    padding-left: 20px;
    background: #fff;
    border: 0px solid red;
    width: 50%;
    height: 317px;
    .super-member-albought {
      width: 100%;
      height: 300px;
      background: #e2e2e2;
      margin-top: 18px;
      .swiper-container {
        margin: 0 auto;
        position: relative;
        overflow: hidden;
        list-style: none;
        padding: 0;
        z-index: 1;
      }
    }
    img {
      width: 720px;
    }
  }
  .fr {
    float: right;
  }
}
.user-info-wrapper.no-manager {
  padding-bottom: 30px;
  .user-info {
    border-bottom-color: #c9c9c9;
    position: relative;
    height: 147px;
    // border-bottom: 1px solid #eaa575;
    padding-top: 30px;
    box-sizing: border-box;
    .user-media {
      margin-bottom: 30px;
      .media-left {
        float: left;
        width: 60px;
        height: 60px;
        img {
          display: block;
          width: 60px;
          height: 60px;
          background: #ccc;
          border-radius: 50%;
          overflow: hidden;
        }
      }
      .media-body {
        padding: 9px 0 0 80px;
        .name {
          display: block;
          font-size: 18px;
          font-weight: 700;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
      }
    }
    .company-name {
      background: url(../../assets/image/productimgwatermark2.png)
        left center no-repeat;
      background-size: 16px 14px;
      padding-left: 22px;
      margin-bottom: 12px;
      cursor: pointer;
      .rewrite-report {
        color: #ff6900;
      }
    }
    .rewrite-report-name {
      height: 22px;
      cursor: default !important;
    }
  }
  .annex-info {
    //  height: 71px;
    padding-bottom: 15px;
    box-sizing: border-box;
    .annex-item {
      width: 33.3333%;
      text-align: center;
      font-size: 12px;
      p {
        font-size: 24px;
      }
      span {
        color: rgb(153, 153, 153);
      }
    }
    .club-priv.wdqb .level {
      width: 30px;
      height: 20px;
      display: inline-block;
      background: url(../../assets/image/productimgwatermark2.png)
        0 0 no-repeat;
      background-size: 30px 20px;
      font-size: 12px;
      line-height: 18px;
      text-align: center;
    }
  }
}
.clearfix:after,
.clearfix:before {
  content: "";
  display: table;
  line-height: 0;
}
.user-info-wrapper {
  position: relative;
  height: 318px;
  background-size: cover;
  padding: 0 20px;
  box-sizing: border-box;
}

.divmian {
  margin-top: 5px;
  overflow: hidden;
  .fl {
    width: 100%;
  }
  .fl {
    float: left;
    width: 49%;
  }
  .f2 {
    float: right;
    width: 50%;
  }
  .analysis-area {
    background: #fff;
    .icon {
      display: inline-block;
      width: 14px;
      height: 14px;
      background-position: center center;
      background-repeat: no-repeat;
      vertical-align: middle;
      position: relative;
      top: -1px;
    }
    .z-panel {
      background-color: #fff;
      margin-top: 10px;
      .z-panel-header h4 {
        font-size: 17px;
        font-weight: 700;
        line-height: 1;
        padding: 10px 20px;
      }
      .z-panel-header .more {
        cursor: pointer;
      }
      .z-panel-header .more {
        font-size: 14px;
        font-weight: 400;
        float: right;
        margin-top: 3px;
      }
      .z-panel-body {
        padding: 0 20px 20px;
        .order-list {
          table-layout: fixed;
          width: 100%;
          th {
            padding: 6px 30px;
            background-color: #fbfbfb;
            font-weight: 400;
            text-align-last: left;
          }
        }
        .service-cont {
          .service-list {
            overflow: hidden;
            .service-item-wrap {
              width: 30%;
              display: inline-block;
              vertical-align: top;
              // text-align: center;
              padding: 10px;
              margin: 0 1%;
              transition: box-shadow 0.3s ease 0s;
              cursor: pointer;
              .service-item {
                font-size: 14px;
                text-align: left;
                overflow: hidden;
                position: relative;
                .service-cover {
                  display: block;
                  border: 1px solid #eee;
                  background: url(../../assets/image/productimgwatermark2.png)
                    center center no-repeat;
                  background-color: #fafafa;
                  position: relative;
                  img {
                    width: 100%;
                    height: 100%;
                    line-height: 1;
                    vertical-align: top;
                    object-fit: cover;
                  }
                }
              }
              .service-info {
                width: 100%;
                background-color: #fff;
                transition: bottom 0.3s ease 0s;
                font-size: 12px;
                font-weight: 500;
              }
            }
          }
        }
      }
    }
  }
}
.z-panel-header {
  clear: both;
}
.parkingOrderDaetails {
  cursor: pointer;
  color: #3289e2;
}
.el-table {
  font-size: 12px;
}
h4 {
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  padding: 10px 20px;
}
.qsdata {
  width: 222px;
  height: 30px;
  line-height: 30px;
  background: #9d1b75;
  text-align: center;
  color: #fbfbfb;
}
.nav_bt {
  border-bottom: 2px solid #9d1b75;
}
.spanRight {
  cursor: pointer;
  padding-top: 10px;
  padding-right: 10px;
  float: right;
  color: #9d1b75;
  z-index: 999;
}
.rgb3737170 {
  color: rgb(37, 37, 170);
}
</style>